package com.oig.sys.msg.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.oig.common.validator.EnumValue;
import com.oig.common.validator.GroupAdd;
import com.oig.common.validator.GroupEdit;
import com.oig.sys.msg.constants.MsgEnums;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import java.util.Date;

@Schema
@Data
public class PushChannelDto {

    @Schema(description = "消息内容id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Integer id;

    @Schema(description = "渠道名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,渠道名称为空", groups = {GroupAdd.class, GroupEdit.class})
    private String channelName;

    @Schema(description = "消息类型 01-定向消息， 02-群消息", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,消息类型不能为空", groups = {GroupAdd.class, GroupEdit.class})
    @EnumValue(message = "渠道类型不正确", enumClass = MsgEnums.MsgType.class, enumValidMethod = "validCode", groups = {GroupAdd.class, GroupEdit.class})
    private String supportMsgType;

    @Schema(description = "渠道类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,渠道类型不能为空", groups = {GroupAdd.class, GroupEdit.class})
    @EnumValue(message = "渠道类型不正确", enumClass = MsgEnums.MsgChannel.class, enumValidMethod = "validCode", groups = {GroupAdd.class, GroupEdit.class})
    private String channelType;

    @Schema(description = "渠道配置", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,渠道配置不能为空", groups = {GroupAdd.class, GroupEdit.class})
    private String channelConfig;

    @Schema(description = "status", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String status;

    @Schema(description = "remark")
    private String remark;

    @Schema(description = "所属租户id")
    private Integer tenantId;
    @Schema(description = "所属租户名称")
    private String tenantName;

    @Schema(description = "创建人id")
    private Integer createUserId;
    @Schema(description = "创建人名称")
    private String createUserName;
    @Schema(description = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Schema(description = "最后修改人id")
    private Integer lastUpdateId;
    @Schema(description = "最后修改人名称")
    private String lastUpdateName;
    @Schema(description = "最后修改时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastUpdateTime;
}
